package com.liuyi.usercenterservice.tools;

/**
 * @author 刘燚
 * @version v1.0.0
 * @Description TODO
 * @createDate：2024/4/21 22:52
 * @email liuyia2022@163.com
 */
public class StringUtils {
    /**
     * 字段转化
     * @param field
     * @return
     */
    public static String toDatabaseField(String field){
        char[] chars = field.toCharArray();
        StringBuilder stringBuilder = new StringBuilder();
        for (char aChar : chars) {
            if (aChar <= 90 ){
                stringBuilder.append("_" + (char)(aChar+32));
            }else {
                stringBuilder.append(aChar);
            }
        }
        return stringBuilder.toString();
    }
}
